export function inRange(value: number, min: number, max: number) {
    return value >= min && value <= max
}

export function inArray<T>(value: T, array: T[]) {
    return array.indexOf(value) >= 0
}

/**
 * 大于等于
 */
export function greaterOrEqual(a: number, b: number, epsilon: number = 1e-7): boolean {
    return equal(a, b, epsilon) || a > b;
}

/**
 * 小于等于
 */
export function lessOrEqual(a: number, b: number, epsilon: number = 1e-7): boolean {
    return equal(a, b, epsilon) || a < b;
}

/**
 * 等于
 */
export function equal(a: number, b: number, epsilon: number = 1e-7): boolean {
    return Math.abs(a - b) < epsilon;
}